import request from '@/utils/request'

// 获取企业列表
export function getCompanyListAPI(params) {
  return request({
    url: '/park/enterprise',
    method: 'GET',
    params
  })
}

// 获取行业列表
export function getIndustryListAPI() {
  return request({
    url: '/park/industry'
  })
}

// 上传企业营业执照
export function uploadRequestAPI(data) {
  return request({
    url: '/upload',
    method: 'POST',
    data
  })
}

// 添加企业
export function addCompanyAPI(data) {
  return request({
    url: '/park/enterprise',
    method: 'POST',
    data
  })
}

// 查看(编辑)企业详情
export function getCompanyDetailAPI(id) {
  return request({
    url: `/park/enterprise/${id}`,
    method: 'GET'
  })
}

// 修改企业信息
export function editCompanyAPI(data) {
  return request({
    url: '/park/enterprise',
    method: 'PUT',
    data
  })
}

// 删除企业信息
export function deleteCompanyAPI(id) {
  return request({
    url: `/park/enterprise/${id}`,
    method: 'DELETE'
  })
}

// 获取楼宇列表
export function getBuildingListAPI() {
  return request({
    url: '/park/building'
  })
}

// 上传合同
export function uploadContractAPI(data) {
  return request({
    url: '/upload',
    method: 'POST',
    data
  })
}

// 添加/续租企业的租赁合同
export function addContractAPI(data) {
  return request({
    url: '/park/enterprise/rent',
    method: 'POST',
    data
  })
}

// 获取合同列表
export function getContractListAPI(id) {
  return request({
    url: `/park/enterprise/rent/${id}`
  })
}

// 退租
export function outRentAPI(id) {
  return request({
    url: `/park/enterprise/rent/${id}`,
    method: 'put'
  })
}

// 删除租赁合同
export function deleteContractAPI(id) {
  return request({
    url: `/park/enterprise/rent/${id}`,
    method: 'delete'
  })
}

// 获取企业详情
export function getCompanyDetail(id) {
  return request({
    url: `/park/enterprise/${id}`,
    method: 'get'
  })
}
